﻿<?php
require_once('../db/check_login.php');
require_once('../db/config.php');
$db=new db($config);
$data=$db->getAll('artclass');
?>
<style type="text/css">
td{ border:1px solid #0FF; }
td#class_1{padding-left:15px;}
td#class_2{padding-left:35px;}
</style>
<p><a href="add.php">添加分类</a></p>
<form id="form1" name="form1" method="post" action="del.php">
<table width="100%" border="0">
<tr>
  <td colspan="3">
    <input type='checkbox' name='checkAll[]' id='checkAll'/>
    <input type="submit" name="delAll" id="delAll" value="删除" />
    </td>
    </tr>
<?php  foreach($data as $val):?>
            
  <tr>
    <td width="3%"><input type="checkbox" name="artclass[]" value="<?php echo $val['id'];?>" class="artclass" /></td>
    <td width="68%" id="class_<?php echo $val['grand'];?>"><?php echo $val['name'];?></td>
    <td width="29%">
    <a href="add.php?id=<?php echo $val['id'];?>&grand=<?php echo $val['grand'];?>">增加</a>
    <a href="del.php?id=<?php echo $val['id'];?>">删除</a>
    </td>
  </tr>
<?php endforeach;?>
</table>
 </form>
 <script src="../js/jquery-2.0.js"></script>
 <script type="text/javascript">
 $(document).ready(function() {
   $('#checkAll').click(function() {
        if (this.checked) {
            $('.artclass').each(function() {
                this.checked = true;
            });
        } else {
            $('.artclass').each(function() {
                this.checked = false;
            });
        }
    });
 });
 </script>